package ca.jsbr.canvaswar.screen 
{
	import ca.jsbr.as2js_lib.display.animations.Tween;
	import ca.jsbr.as2js_lib.display.canvas.Node2D;
	import ca.jsbr.as2js_lib.display.canvas.view.SpriteView;
	import ca.jsbr.as2js_lib.event.MouseJSEvent;
	import ca.jsbr.as2js_lib.utils.assets.AssetsFactory;
	import ca.jsbr.as2js_lib.utils.MouseManager;
	import ca.jsbr.canvaswar.games.MapManager;
	import ca.jsbr.canvaswar.games.mission.Test2Mission;
	import ca.jsbr.canvaswar.games.MissionManager;
	import ca.jsbr.canvaswar.screen.Screen;
	/**
	 * ...
	 * @author 
	 */
	public class GameScreen extends Screen
	{
		private var _mapGenerator:MapManager;
		private var _cursor:SpriteView;
		private var _missionLayer:Node2D;
		
		public function GameScreen() 
		{
			_missionLayer = new Node2D();
		}
		
		override public function init():Object 
		{
			
			/*_cursor = new SpriteView(AssetsFactory.getInstance().getAssets("cursor"), 16, 4);
			_cursor.defineAnimation("default", 1, 16);
			_cursor.defineAnimation("attack", 17, 32);
			_cursor.play("default");*/
			/*var asset:SpriteView = new SpriteView(AssetsFactory.getInstance().getAssets("tiles"), 6, 5);
			_mapDescriptor = new MapDescription(asset);
			_mapGenerator = new MapManager(_mapDescriptor);
			_mapGenerator.generate(800,480);
			addChild(_mapGenerator);*/
			addChild(MissionManager.getInstance().layer)
			MissionManager.getInstance().launchMission("Test2Mission");
			//addChild(new Test2Mission());
			//addChild(_cursor);
			//MouseManager.getInstance().addEventListener(MouseJSEvent.MOUSE_MOVE, onMouseMove);
		}
		
		private function onMouseMove(e:MouseJSEvent):void 
		{
			/*var cx:int = Math.floor(e.stageX / 32) * 32;
			var cy:int = Math.floor(e.stageY / 32) * 32;
			_cursor.x = cx;
			_cursor.y = cy;
			new Tween();*/
		}
		
		override public function destroy():Object 
		{
			super.destroy();
			MouseManager.getInstance().removeEventListener(MouseJSEvent.MOUSE_MOVE, onMouseMove);
		}
		
	}

}